package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.asm.Label;
import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.LineNumberBytecodeEvent;

public class LineNumberBytecodeEventImpl extends BytecodeEventImpl implements LineNumberBytecodeEvent
{
    private int lineNumber;
    private Label startLabel;

    public LineNumberBytecodeEventImpl(final int aLineNumber, final Label aStartLabel) {
        lineNumber = aLineNumber;
        startLabel = aStartLabel;
    }

    @Override
    public int getType() {
        return LINE_NUMBER;
    }

    @Override
    public void setLineNumber(final int aLineNumber) {
        lineNumber = aLineNumber;
    }

    @Override
    public int getLineNumber() {
        return lineNumber;
    }

    @Override
    public void setStartLabel(final Label aStartLabel) {
        startLabel = aStartLabel;
    }

    @Override
    public Label getStartLabel() {
        return startLabel;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitLineNumber(this);
        return aBytecodeVisitor;
    }
}
